﻿<?php defined("MAIN_DIR") or die("No direct access");

$yestarday = get_rates(date("Y-m-d",time()-86400));
$today = get_rates(date("Y-m-d"));
?>
<div>
	<span class="curency_heading">Курсы валют</span>&nbsp;
	<span class="curency_date">ЦБ РФ на <?php echo date("d.m.Y");?></span>
</div>
<div class="curency_table">
	<table width="201" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="74" align="left" valign="top" class="curency_dollar"><strong>Доллар</strong></td>
			<td width="55" align="left" valign="top"><?php echo number_format($today['dollar'],2)?></td>
			<td width="72" align="left" valign="top" <?php
			if ($today['dollar'] < $yestarday['dollar'])
			{
				$percent = number_format($yestarday['dollar']-$today['dollar'],2);
				echo "class='curency_down'>$percent &darr;";
			}
			elseif ($today['dollar'] > $yestarday['dollar'])
			{
				$percent = number_format($today['dollar']-$yestarday['dollar'],2);
				echo "class='curency_up'>$percent &uarr;";
			}
			else
				echo " style='color:gray'>0.00";
			?></td>
		</tr>
		<tr>
			<td align="left" valign="top"><strong>Евро</strong></td>
			<td align="left" valign="top"><?php echo number_format($today['euro'],2)?></td>
			<td align="left" valign="top" <?php
				if ($today['euro'] < $yestarday['euro'])
				{
					$percent = number_format($yestarday['euro'] - $today['euro'],2);
					echo "class='curency_down'>$percent &darr;";
				}
				elseif ($today['euro'] > $yestarday['euro'])
				{
					$percent = number_format($today['euro'] - $yestarday['euro'],2);
					echo "class='curency_up'>$percent &uarr;";
				}
				else
					echo " style='color:gray'>0.00";
			?></td>
		</tr>
	</table>
</div>